package com.jfree.kafkamanager.common;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Component;

/**
 * @author wangjian
 * @date 2019/10/14 11:47
 */
@Component
public class KafkaSender {

    @Autowired
    private KafkaTemplate<String, String> kafkaTemplate;

    // 发送消息方法
    public void send(String body) {
        kafkaTemplate.send("testTopic", body);
    }
}
